package com.desmart.renjiao.orgainzation;

import android.support.annotation.Nullable;
import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.desmart.renjiao.R;
import com.desmart.renjiao.bean.Company;
import com.desmart.renjiao.contants.Constants;
import com.lemon.library.common.ARoutePath;

import java.util.List;

public class DepartmentItemAdapter extends BaseQuickAdapter<Company.Department,BaseViewHolder>{

    public DepartmentItemAdapter(@Nullable List<Company.Department> data) {
        super(R.layout.list_item_orgainzation, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Company.Department item) {
        helper.setText(R.id.tv_title,item.getDepartmentname());
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ARouter.getInstance().build(ARoutePath.addresslist.DepartmentMemberListActivity)
                        .withSerializable(Constants.Department.Key_DepartMent,item)
                        .navigation(mContext);
            }
        });
        helper.setImageResource(R.id.image,R.drawable.ic_department);
    }
}
